package dlb.busstop.utils;

import java.util.List;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import dlb.busstop.data.Bus;

public class ScreenSlidePagerAdapter extends PagerAdapter {

	private List<Bus> mItems;
	private Context mContext;

	public ScreenSlidePagerAdapter(List<Bus> items, Context context) {
		mItems = items;
		mContext = context;
	}

	@Override
	public int getCount() {
		return mItems.size();
	}

	@Override
	public Object instantiateItem(ViewGroup container, int position) {
		LayoutInflater inflater = LayoutInflater.from(mContext);
		View v = inflater.inflate(0, null);

		((ViewPager) container).addView(v, 0);
		return v;
	}

	@Override
	public boolean isViewFromObject(View view, Object object) {
		return view == object;
	}

	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		((ViewPager) container).removeView((View) object);
	}
}